package fr.demos.cinepantin;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;

import com.sun.xml.rpc.processor.modeler.j2ee.xml.string;

import fr.demos.cinepantin.enumerate.Civilite;

/**
 * 
 * @author Demos Stagiaires CQP-DNT 
 * Classe Client
 */

@Entity
public class Client implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int idClient;
	@NotEmpty @NotNull(message="Veuillez saisir un mail")
	private String email;
	@NotEmpty @NotNull(message="veuillez saisir un password")
	private String password;
	@Enumerated(EnumType.STRING)
	private Civilite civilite;
	@NotEmpty @NotNull(message="veuillez saisir un nom") 
	private String nom;
	private String prenom;
	private String numPortable;
	
    @OneToMany()
	private List<Facture> factures;
    @OneToOne()
	private Panier panier;
	@OneToMany()
	private List<AdressePostal> adressePostals;
/**
 * @param idClient
 * @param civilite
 * @param nom
 * @param prenom
 * @param numPortable
 * @param email
 * @param password
 * @param factures
 * @param panier
 * @param adressePostals
 */
	
	public Client() {

	}

/**
 * Constructeur pour l'inscription d'un client
 * 
 * @param civilite
 * @param nom
 * @param prenom
 * @param numPortable
 * @param adressePostals
 * @param email
 * @param password
 */


public Client(int idClient,String email, String password, Civilite civilite,
	String nom, String prenom, String numPortable) {
this.idClient = idClient;
this.email = email;
this.password = password;
this.civilite = civilite;
this.nom = nom;
this.prenom = prenom;
this.numPortable = numPortable;
}

public Client(int idClient,String email,String password,Civilite civilite,String nom, String prenom, String numPortable,List<AdressePostal> adressePostals){
	this(idClient,email,password,civilite,nom,prenom,numPortable );
this.adressePostals=adressePostals;
}


/**
 * Constructeur pour l'inscription d'un client ET
 * L'affichage de panier qui contient tous les articles commander par le client
 * 
 * @param idClient
 * @param civilite
 * @param nom
 * @param prenom
 * @param numPortable
 * @param email
 * @param password
 * @param panier
 * @param adressePostals
 */
	public Client(int idClient,String email, String password,Civilite civilite,String nom, String prenom, String numPortable,
			List<AdressePostal> adressePostals, Panier panier,List<Facture> factures ) {
		this(idClient,email, password,civilite, nom, prenom, numPortable, adressePostals);
		this.panier = panier;
		this.factures = factures ;

	}

	/**
	 * Get Client
	 * @return idClient
	 */
	

	public boolean containsAdresse(AdressePostal adressepost) {
		return adressePostals.contains(adressepost);
	}

	public int getIdClient() {
		return idClient;
	}
	
	/**
	 * set Client
	 * @param idClient
	 */

	public void setIdClient(int idClient) {
		this.idClient = idClient;
	}
	
	/**
	 * GET Nom
	 * @return nom de client
	 */

	public String getNom() {
		return nom;
	}
	
	/**
	 * SET Nom
	 * @param nom
	 */

	public void setNom(String nom) {
		this.nom = nom;
	}
	/**
	 * GET Prenom
	 * @return Prenom de Client
	 */

	public String getPrenom() {
		return prenom;
	}
	
	/**
	 * SET Prenom
	 * @param prenom
	 */

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}
	/**
	 * GET numero portable de Client
	 * @return numPortable
	 */

	public String getNumPortable() {
		return numPortable;
	}
	/**
	 *SET Numero portable 
	 * @param numPortable
	 */

	public void setNumPortable(String numPortable) {
		this.numPortable = numPortable;
	}
	/**
	 * GET Email de Client
	 * @return email
	 */

	public String getEmail() {
		return email;
	}
	
	/**
	 * SET Email
	 * @param email
	 */

	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 * GET Panier de Client
	 * @return panier
	 */

	public Panier getPanier() {
		return panier;
	}
	/**
	 * SET Panier 
	 * @param panier
	 */

	public void setPanier(Panier panier) {
		this.panier = panier;
	}
	/**
	 * GET password de client
	 * @return password
	 */


	public String getPassword() {
		return password;
	}
	/**
	 * SET Password 
	 * @param password
	 */

	public void setPassword(String password) {
		this.password = password;
	}
	/**
	 * GET Civilite de Client
	 * @return Civilite
	 */

	public Civilite getCivilite() {
		return civilite;
	}
	/**
	 * SET Civilite 
	 * @param civilite
	 */

	public void setCivilite(Civilite civilite) {
		this.civilite = civilite;
	}

}